package com.app.ctzoverseas.network.repo

import com.app.ctzoverseas.network.http.AddressNetwork
import com.app.ctzoverseas.network.http.GoodsNetwork
import com.app.ctzoverseas.network.http.LoginNetwork
import com.cardetective.shopcar.network.model.AddCarPost
import com.cardetective.shopcar.network.model.BindMobilePost
import com.cardetective.shopcar.network.model.LoginPost

class AddressRepo(private val network: AddressNetwork) {

    fun getDefaultAddress() = network.getDefaultAddress()
    fun addAddress(firstName: String,surName: String,userMobile: String,etHouse: String,isDefault: Boolean) = network.addAddress(firstName, surName, userMobile, etHouse, isDefault)
    fun getAddressList(pageNumber: Int,pageSize: Int) = network.getAddressList(pageNumber, pageSize)
    fun deleteAddress(addressId: String) = network.deleteAddress(addressId)
    fun updateAddress(addressId: String,isDefault:Boolean) = network.updateAddress(addressId,isDefault)

    companion object {

        @Volatile
        private var INSTANCE: AddressRepo? = null

        fun getInstance(netWork: AddressNetwork) =
            INSTANCE ?: synchronized(this) {
                INSTANCE ?: AddressRepo(netWork).also { INSTANCE = it }
            }
    }
}